package org.ling.xuan.handler;

import org.ling.xuan.context.CheckChannelContext;
import org.ling.xuan.context.CheckPipelineContext;
import org.ling.xuan.rule.CheckRule;
import org.ling.xuan.util.ExUtil;
import org.ling.xuan.util.LoggerUtil;

public class CheckExceptionHandler {

    public static <R extends CheckPipelineContext, T extends CheckChannelContext> void handleRule(R pipeContext, T channelContext, CheckRule<T, R> checkRule, Exception e) {
        LoggerUtil.log(pipeContext.getProject(), ExUtil.getExMsg(e, "\n"));
    }

    public static <R extends CheckPipelineContext> void handleChannel(R pipeContext, CheckChannelContext channelContext, Exception e) {
        LoggerUtil.log(pipeContext.getProject(), ExUtil.getExMsg(e, "\n"));
    }
}
